package screen;

import resources.IActivityRequestHandler;
import resources.Input;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetErrorListener;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.assets.loaders.TextureLoader;
import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver;
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import common.Constant;


public abstract class Screen implements AssetErrorListener{
	protected Game game;
	protected IActivityRequestHandler requestHandler;
	protected SpriteBatch spriteBatch;
	protected OrthographicCamera camera;
	public Screen (Game game) {
		this.game = game;
		camera = new OrthographicCamera(Constant.SCREEN_WIDTH,Constant.SCREEN_HEIGHT);
		camera.position.set(Constant.SCREEN_WIDTH/ 2, Constant.SCREEN_HEIGHT / 2, 0);
		spriteBatch = new SpriteBatch();
		spriteBatch.setProjectionMatrix(camera.combined);
	}

	public Screen(Game game, IActivityRequestHandler requestHandler) {
		this.game = game;
		this.requestHandler = requestHandler;
		camera = new OrthographicCamera(Constant.SCREEN_WIDTH,Constant.SCREEN_HEIGHT);
		camera.position.set(Constant.SCREEN_WIDTH/ 2, Constant.SCREEN_HEIGHT / 2, 0);
		spriteBatch = new SpriteBatch();
		spriteBatch.setProjectionMatrix(camera.combined);
	}
	public void draw (TextureRegion region, float x, float y) {
		spriteBatch.draw(region, x, y);
	}
	public abstract void present ();

	public abstract void pause ();

	public abstract void resume ();

	public abstract void dispose ();

	public void tick(Input input) {		
	}
	public void error (String fileName, Class type, Throwable t) {
        Gdx.app.error("AssetManagerTest", "couldn't load asset '" + fileName + "'", (Exception)t);
	}
}
